//
//  MyTableHeaderView.m
//  ForeverLove
//
//  Created by lanou3g on 15/11/17.
//  Copyright © 2015年 文萱竹. All rights reserved.
//

#import "MyTableHeaderView.h"

@implementation MyTableHeaderView
/*
 @property (nonatomic, strong, null_resettable)    UIColor *tintColor;
 @property (nonatomic, readonly, strong, nullable) UILabel *textLabel;
 @property (nonatomic, readonly, strong, nullable) UILabel *detailTextLabel;
 @property (nonatomic, readonly, strong)           UIView *contentView;
 @property (nonatomic, strong, nullable)           UIView *backgroundView;
 @property (nonatomic, readonly, copy, nullable)   NSString *reuseIdentifier;
 */

- (instancetype)initWithReuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithReuseIdentifier:reuseIdentifier];
    if (self) {
        
        [self setFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, kHeaderViewHerght)];
        self.contentView.backgroundColor = [UIColor orangeColor];
        NSLog(@"实例化标题行 %@", NSStringFromCGRect(self.bounds));
        // 按钮
        self.detailBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [_detailBtn setFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, kHeaderViewHerght)];
        [_detailBtn setBackgroundColor:[UIColor redColor]];
        [_detailBtn addTarget:self action:@selector(clickButton) forControlEvents:UIControlEventTouchUpInside];
        [self addSubview:_detailBtn];
        
    }
    return self;
}

- (void)clickButton
{
    NSLog(@"click !");
    // 通知代理实现协议方法
    if (self.delegate && [self.delegate respondsToSelector:@selector(myHeaderViewDidSelected:)]) {
        [self.delegate myHeaderViewDidSelected:self];
    }
}




/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
